home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1998 May / Macworld (1998-05).dmg / Serious Demos / Lasso 2.5 Test Drive / Lasso 2.5 Plug-in / Employees / expenses.lasso < prev    next >
Text File  |  1997-12-12  |  3KB  |  39 lines

  1. <!-- This file represents a Lasso processing file that determines what to actually display. It does not contain any HTML but simply determines how to display the included file, and depends upon the actions that occurred before the file is processed.
  2.  
  3. The expenses list is edited directly through a portal. To delete a portal row, the related database must include a unique field or serial number to identify that specific record (a field value that is in addition to the hidden record id value).
  4.  
  5. A conditional is used to determine if a change has occurred to the contents of the portal rows. In this case, if the previous action was a search on the "Employees_Related.fp3" database then some change has occurred to the portal. The element "database_name" is a Lasso substitution tag that will be substituted with the value of the database specified in the action that was used to invoke this page. View the "expense_include.html" file for details. 
  6.  
  7. If the last action was not a search then the else is referenced, in this case it is an include that displays the "expense_include.html" format file, which contains the portal. 
  8.  
  9. -->
  10.  
  11. [if: lasso_action=="search" && database_name=="Employees_Related.fp3"]
  12.  
  13. <!-- 
  14. If the format file was processed after a search of the related database has occurred, the inline action will delete a record in the related database. This works since this is the only case in which "Employees_Related.fp3" is searched prior to this page being processed. The database_name tag is used to automatically substitute in the name of the database that the search was performed on, in this case "employees_related."
  15.  
  16. The delete is accomplished by first searching the related "employees_related" database for the "expense_id" field to identify the record to be deleted and this page acts as the reply page of that search. See the "expense_include.html" file for details. 
  17. -->
  18.  
  19. [inline: database=database_name, recid=recid_value, token=token_value, delete]
  20. [/inline]
  21.  
  22. <!--  The second, inline action occurs to search the employees database and find the changed contents of the portal.  This is accomplish using a token that was set previously to the value of the "employee_id" field. The "employee_id" field is the unique serial number field used to identify the record. It is used in lieu of the actual record id (which is not available when switching between related databases).   -->
  23.  
  24. [inline: database="Employees.fp3", layout="detail", "employee_id"=token_value, search]
  25.  
  26. <!-- A second, nested, inline action is used to "force" FileMaker to update the values in the portal. The second search is not needed, however, if not used, the delete may need to be selected twice. A new token is set for the text on the reply to indicate a row had been deleted. -->
  27.  
  28. [inline: database="Employees.fp3", layout="detail", token="rowgone", recid=recid_value, search]
  29. [include: "expense_include.html"]
  30. [/inline]
  31.  
  32. [/inline]
  33.  
  34.  
  35. [else]
  36.  
  37. [include: "expense_include.html"]
  38.  
  39. [/if]